﻿


<div ms-controller="tmpmodelview">
    <div class="control-group">
        <label class="control-label v-top">
            <b style="color: #f00;">*</b>
            城市
        </label>
        <div class="controls">
            <select class="input-large input-xfat" ms-duplex="ModelData.Client">
                <option ms-repeat-el="ClientList" ms-attr-value="el.ID">{{el.CodeName}}</option>
            </select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label"><b style="color: #f00;">*</b>分类：</label>
        <div class="controls">
            <select class="input-medium input-xfat" ms-duplex="ModelData.InfoType">
                <option value="">请选择分类</option>
                <option value="1">保险金融</option>
                <option value="2">社区服务</option>
            </select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label v-top">
            <b style="color: #f00;">*</b>
            标题：
        </label>
        <div class="controls">
            <input type="text" class="input-xxlarge input-xfat" ms-duplex="ModelData.Title" data-rules="required" >
        </div>
    </div>
    <div class="control-group">
        <label class="control-label v-top">
            照片：
        </label>
        <div class="controls" style="width:900px">
            <ul class="sui-row-fluid" id="layer-photos-demo">
                <li class="span2" ms-repeat-el="FileData">
                    <div class="img-round">
                        <img ms-attr-layer-src="{{ComFunJS.FilePath(el)}}" ms-attr-data-id="el" ms-attr-src="ComFunJS.FilePath(el,'/100/100')" alt="">
                    </div>
                    <label>
                        <label> <a href="javascript:void(0);" class="sui-btn btn-bordered btn-small btn-danger" ms-click="DelFile(el)">删除</a> </label>
                    </label>
                </li>
                <li class="span2">
                    <button ms-click="FileUpload()" style="margin:15px 0" class="sui-btn btn-xlarge btn-success">添加图片</button>
                </li>
            </ul>
        </div>
    </div>

    <div class="control-group">
        <label class="control-label v-top">
            简述：
        </label>
        <div class="controls">
            <input type="text" class="input-xxlarge input-xfat" ms-duplex="ModelData.Summary">
        </div>
    </div>

    <div class="control-group">
        <label class="control-label v-top">
            详情：
        </label>
        <div class="controls">
            <textarea id="txtDetails" class="input-xxlarge bw_ueditor" rows="5" ms-duplex="ModelData.Details"></textarea>
        </div>
    </div>
</div>



<script type="text/javascript">
    var tempmodel = avalon.define({
        $id: "tmpmodelview",
        ModelData: { "Client": "1", "InfoType": ComFunJS.getQueryString("infotype"), "Type1": "", "Title": "", "ImgUrl": "", "Details": "", "LinkUrl": "", "Sort": "1", "StartDate": ComFunJS.getNowDate("yyyy-MM-dd HH:mm:ss"), "EndDate": "", "IsSign": "0", "LimitQty": "0", "Price1": "0", "Price2": "0", "Summary": "", "Comment": "", "Comment2": "" },
        ClientList: [],
        CatData1: [],
        Init: function (ID) {
            $.getJSON("/adapi/base/client/list", function (r) {
                if (r.error == "") {
                    tempmodel.ClientList = r.result;
                }

            })
            if (ID) {
                $.getJSON("/adapi/info/model/" + ID, function (r) {
                    if (r.error == "") {
                        tempmodel.ModelData = r.result;
                        if (r.result.ImgUrl) {
                            pmodel.FileData = r.result.ImgUrl.split(",");
                        }
                        setTimeout("ComFunJS.initForm();", 500);
                    }

                })
            } else {
                ComFunJS.initForm();
            }
        },
        tmpSaveData: function () {
            tempmodel.ModelData.ImgUrl = pmodel.GetFileIds();
            $.post("/adapi/info/add", tempmodel.ModelData.$model, function (r) {
                if (r.error == "") {
                    top.ComFunJS.winShowMsg("操作成功");
                    top.ComFunJS.close();
                } else {
                    top.ComFunJS.winShowAlert(r.error);
                }

            })
        }

    });


</script>




